/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entite;

import connexion.Connexion;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 *
 * @author asall
 */
public class Ufr {
     static Connexion con= new Connexion();    
        
     public String getLibelleLong(int idDiplome) {
		String res="libelle long";
		try {
			Statement req = con.getInstance().createStatement();

                        ResultSet resultatDest = req.executeQuery("select cp.libelle_long"
                                + " from diplome di, composante cp"
                                + " where  di.fid_comp=cp.id_comp"
                                + " and di.id_dip= "+ idDiplome );

			while (resultatDest.next()) {
				res=(resultatDest.getString("libelle_long"));
				return res;
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return res;
	}     
        public String getCodeUfr(int idDiplome) {
		String res="code UFR";
		try {
			Statement req = con.getInstance().createStatement();

                        ResultSet resultatDest = req.executeQuery("select cp.code_apogee"
                                + " from diplome di, composante cp"
                                + " where di.fid_comp=cp.id_comp"
                                + " and di.id_dip= "+ idDiplome );

			while (resultatDest.next()) {
				res=(resultatDest.getString("code_apogee"));
				return res;
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return res;
	}     

        public String getLibelleCourt(int idDiplome) {
		String res="libelle court";
		try {
			Statement req = con.getInstance().createStatement();

                        ResultSet resultatDest = req.executeQuery("select cp.libelle_court"
                                + " from diplome di, composante cp"
                                + " where  di.fid_comp=cp.id_comp"
                                + " and di.id_dip= "+ idDiplome );

			while (resultatDest.next()) {
				res=(resultatDest.getString("libelle_court"));
				return res;
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return res;
	}
        public String getCodeDomaine(int idDiplome) {
		String res="code Domaine";
		try {
			Statement req = con.getInstance().createStatement();

                        ResultSet resultatDest = req.executeQuery("select do.code_apogee"
                                + " from diplome di, composante cp, domaine do"
                                + " where cp.fid_dom=do.id_dom and di.fid_comp=cp.id_comp"
                                + " and di.id_dip= "+ idDiplome );

			while (resultatDest.next()) {
				res=(resultatDest.getString("code_apogee"));
				return res;
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return res;
	}
        public String getLibelleDomaine(int idDiplome) {
		String res="libelle Domaine";
		try {
			Statement req = con.getInstance().createStatement();

                        ResultSet resultatDest = req.executeQuery("select do.libelle_domaine"
                                + " from diplome di, composante cp, domaine do"
                                + " where cp.fid_dom=do.id_dom and di.fid_comp=cp.id_comp"
                                + " and di.id_dip= "+ idDiplome );

			while (resultatDest.next()) {
				res=(resultatDest.getString("libelle_domaine"));
				return res;
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
		return res;
	}

}
